/*
 * Copyright (C) 2025 Tsingteng MicroSystem
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file rw_t5t_common.h
 * @brief 定义t5t卡片操作相关数据结构和方法
 */

#ifndef RW_T5T_COMMON_H
#define RW_T5T_COMMON_H

#if IS_FEATURE_ON(NCI_FEATURE_RW_T5T)
#include <stdint.h>
#include <stdbool.h>
#include "nci_defs.h"
#include "nci_transport.h"

#define I93_UID_BYTE_LEN 8

#define I93_VERSION_1_x 0x40 /* major mapping version 1.x */

/* A single sub-carrier frequency shall be used by VICC */
#define I93_FLAG_SUB_CARRIER_SINGLE 0x00

/* High data rate shall be used */
#define I93_FLAG_DATA_RATE_HIGH 0x02

/* Flags 5 to 8 meaning is according to table 5 */
#define I93_FLAG_INVENTORY_SET 0x04

/* No protocol format extension                         */
#define I93_FLAG_PROT_EXT_NO 0x00
/* Protocol format is extended. Reserved for future use */
#define I93_FLAG_PROT_EXT_YES 0x08

/* Request is addressed with Address Mode Selector. UID field is included.
 * It shall be executed only by VICC */
#define I93_FLAG_ADDRESS_SET 0x20
/* whose UID matches the UID specified in the request */
/* Request is addressed with SMS (Select Mode Selector). UID field is included
 * or not.  It shall be executed by the unique VICC to be in SELECTED state */
#define I93_FLAG_SELECT_SET 0x10

/* AFI field is present     */
#define I93_FLAG_AFI_PRESENT 0x10

#define I93_FLAG_SLOT_ONE 0x20  /* 1 slot   */

/* It shall be set to 0 if not otherwise defined by command */
/* Meaning is defined by the command description. */
#define I93_FLAG_OPTION_SET 0x40

/* Error detected, Error code is in the "Error" field */
#define I93_FLAG_ERROR_DETECTED 0x01

/* Response error code */
#define I93_ERROR_CODE_NO_ERROR 0x00
/* The command option is not supported                                   */
#define I93_ERROR_CODE_OPTION_NOT_SUPPORTED 0x03
/* The specific block is was not successfully programmed                 */
#define I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE 0x13
/* The specific block is was not successfully locked                     */

/* UID length in bytes                  */
#define I93_UID_BYTE_LEN 8
/* Data Storage Format is not supported */
#define I93_DFS_UNSUPPORTED 0x00
/* Block is locked                      */
#define I93_BLOCK_LOCKED 0x01

/* ISO 15693 Mandatory commands */
#define I93_CMD_INVENTORY 0x01  /* Inventory  */
#define I93_CMD_STAY_QUIET 0x02 /* Stay Quiet */

/* ISO 15693 Optional commands */
#define I93_CMD_READ_SINGLE_BLOCK 0x20  /* Read single block     */
#define I93_CMD_EXT_READ_SINGLE_BLOCK 0x30 /* Extended Read single block */
#define I93_CMD_WRITE_SINGLE_BLOCK 0x21 /* Write single block    */
#define I93_CMD_EXT_WRITE_SINGLE_BLOCK 0x31 /* Extended Write single block */
#define I93_CMD_LOCK_BLOCK 0x22         /* Lock block            */
#define I93_CMD_EXT_LOCK_BLOCK 0x32     /* Extended Lock block            */
#define I93_CMD_READ_MULTI_BLOCK 0x23   /* Read multiple blocks  */
#define I93_CMD_EXT_READ_MULTI_BLOCK 0x33 /* Extended Read multiple blocks  */
#define I93_CMD_WRITE_MULTI_BLOCK 0x24  /* Write multiple blocks */
#define I93_CMD_EXT_WRITE_MULTI_BLOCK 0x34 /* Write multiple blocks */
#define I93_CMD_SELECT 0x25             /* Select                */
#define I93_CMD_RESET_TO_READY 0x26     /* Reset to ready        */
#define I93_CMD_WRITE_AFI 0x27          /* Wreite AFI            */
#define I93_CMD_LOCK_AFI 0x28           /* Lock AFI              */
#define I93_CMD_WRITE_DSFID 0x29        /* Write DSFID           */
#define I93_CMD_LOCK_DSFID 0x2A         /* Lock DSFID            */
/* Get system information             */
#define I93_CMD_GET_SYS_INFO 0x2B
/* Get extended system information    */
#define I93_CMD_EXT_GET_SYS_INFO 0x3B
/* Get multiple block security status */
#define I93_CMD_GET_MULTI_BLK_SEC 0x2C
/* Get extended multiple block security status */
#define I93_CMD_EXT_GET_MULTI_BLK_SEC 0x3C
#define I93_CMD_SET_ADDR_MODE 0x3D /* Set address mode            */

/* Information flags definition */
/* DSFID is supported and DSFID field is present */
#define I93_INFO_FLAG_DSFID 0x01
/* DSFID info length */
#define I93_INFO_DSFID_LEN 0x01
/* AFI is supported and AFI field is present     */
#define I93_INFO_FLAG_AFI 0x02
/* AFI info length */
#define I93_INFO_AFI_LEN 0x01
/* VICC memory size field is present             */
#define I93_INFO_FLAG_MEM_SIZE 0x04
/* block size info length */
#define I93_INFO_BLOCK_SIZE_LEN 0x01
/* 8bit num of blocks info length */
#define I93_INFO_8BIT_NUM_BLOCK_LEN 0x01
/* 16bit num of blocks info length */
#define I93_INFO_16BIT_NUM_BLOCK_LEN 0x02
/* IC reference field is present                 */
#define I93_INFO_FLAG_IC_REF 0x08
/* IC ref info length */
#define I93_INFO_IC_REF_LEN 0x01
/* Memory coded in 2 bytes address               */
#define I93_INFO_FLAG_MOI 0x10

/* Max block size in bytes */
#define I93_MAX_BLOCK_LENGH 32

/* Block lengths */
#define I93_BLEN_4BYTES 0x04
#define I93_BLEN_8BYTES 0x08
#define I93_BLEN_16BYTES 0x10
#define I93_BLEN_32BYTES 0x20
/* ICODE Capability Container(CC) definition */
#define I93_ICODE_CC_MAGIC_NUMER_E1 0xE1 /* magic number in CC[0]  */
#define I93_ICODE_CC_MAGIC_NUMER_E2 0xE2 /* magic number in CC[0]  */
/* read access condition in CC[1]        */
#define I93_ICODE_CC_READ_ACCESS_MASK 0x0C
/* read access granted without security  */
#define I93_ICODE_CC_READ_ACCESS_GRANTED 0x00
/* write access condition in CC[1]       */
#define I93_ICODE_CC_WRITE_ACCESS_MASK 0x03
/* write access granted without security */
#define I93_ICODE_CC_WRITE_ACCESS_GRANTED 0x00
/* write access not granted at all       */
#define I93_ICODE_CC_READ_ONLY 0x03
/* read multi block supported in CC[3]   */
#define I93_ICODE_CC_MBREAD_MASK 0x01
/* inventory page read supported in CC[3] */
#define I93_ICODE_CC_IPREAD_MASK 0x02
/* More than 2040 bytes are supported in CC[3] */
#define I93_ST_CC_OVERFLOW_MASK 0x04
#define I93_ONS_CC_OVERFLOW_MASK 0x04
/* Special Frame are supported in CC[3] */
#define I93_ICODE_CC_SPECIAL_FRAME_MASK 0x10

/* ICODE TLV type */
#define I93_ICODE_TLV_TYPE_NULL 0x00 /* NULL TLV         */
#define I93_ICODE_TLV_TYPE_NDEF 0x03 /* NDEF message TLV */
#define I93_ICODE_TLV_TYPE_PROP 0xFD /* Proprietary TLV  */
#define I93_ICODE_TLV_TYPE_TERM 0xFE /* Terminator TLV   */

/* UID Coding (UID Bit 64-57), First byte of ISO 15693 UID */
#define I93_UID_FIRST_BYTE 0xE0

/* UID Coding (UID Bit 56-49), IC manufacturer code */
#define I93_UID_IC_MFG_CODE_ST 0x02
#define I93_UID_IC_MFG_CODE_NXP 0x04
#define I93_UID_IC_MFG_CODE_TI 0x07
#define I93_UID_IC_MFG_CODE_ONS 0x67

#define I93_UID_MSB 0xE0
#define I93_UID_MSB_IND             7
#define I93_UID_MFG_CODE_IND        6
#define I93_UID_MFG_PROD_TYPE_IND   5

/* NXP, UID Coding of ICODE type (UID Bit 48-41) */
/* ICODE SLI, SLIX     */
#define I93_UID_ICODE_SLI 0x01
/* ICODE SLI-S, SLIX-S */
#define I93_UID_ICODE_SLI_S 0x02
/* ICODE SLI-L, SLIX-L */
#define I93_UID_ICODE_SLI_L 0x03

/* IC Reference for ICODE SLI-L */
#define I93_IC_REF_ICODE_SLI_L 0x03
/* read multi block supported check bit */
#define I93_ICODE_IC_REF_MBREAD_MASK 0x02

/* TI, UID Coding of product version (UID Bit 48-42) */
/* upper 7 bits                     */
#define I93_UID_TAG_IT_HF_I_PRODUCT_ID_MASK 0xFE
/* Tag-it HF-I Plus Inlay           */
#define I93_UID_TAG_IT_HF_I_PLUS_INLAY 0x00
/* Tag-it HF-I Plus Chip            */
#define I93_UID_TAG_IT_HF_I_PLUS_CHIP 0x80
/* Tag-it HF-I Standard Chip/Inlyas */
#define I93_UID_TAG_IT_HF_I_STD_CHIP_INLAY 0xC0
/* Tag-it HF-I Pro Chip/Inlyas      */
#define I93_UID_TAG_IT_HF_I_PRO_CHIP_INLAY 0xC4

#define I93_TAG_IT_HF_I_STD_CHIP_INLAY_NUM_TOTAL_BLK 11
#define I93_TAG_IT_HF_I_PRO_CHIP_INLAY_NUM_TOTAL_BLK 12

#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_BLK_SIZE 4
#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_NUM_USER_BLK 8
/* LSB in Block 0x0A */
#define I93_TAG_IT_HF_I_STD_PRO_CHIP_INLAY_AFI_LOCATION 40

/* ST, product version (IC manufacturer code) */
/* IC Reference mask for ST*/
#define I93_IC_REF_ST_MASK 0xFC
/* IC Reference for LRI1K:      010000xx(b), blockSize: 4, numberBlocks: 0x20 */
#define I93_IC_REF_ST_LRI1K 0x40
/* IC Reference for LRI2K:      001000xx(b), blockSize: 4, numberBlocks: 0x40 */
#define I93_IC_REF_ST_LRI2K 0x20
/* IC Reference for LRIS2K:     001010xx(b), blockSize: 4, numberBlocks: 0x40 */
#define I93_IC_REF_ST_LRIS2K 0x28
/* IC Reference for LRIS64K:    010001xx(b), blockSize: 4, numberBlocks: 0x800
 */
#define I93_IC_REF_ST_LRIS64K 0x44
/* IC Reference for M24LR64-R:  001011xx(b), blockSize: 4, numberBlocks: 0x800
 */
#define I93_IC_REF_ST_M24LR64_R 0x2C
/* IC Reference for M24LR04E-R: 01011010(b), blockSize: 4, numberBlocks: 0x80 */
#define I93_IC_REF_ST_M24LR04E_R 0x5A
/* IC Reference for M24LR16E-R: 01001110(b), blockSize: 4, numberBlocks: 0x200
 */
#define I93_IC_REF_ST_M24LR16E_R 0x4E
/* IC Reference for M24LR16D-W: 01001101(b), blockSize: 4, numberBlocks: 0x200
 */
#define I93_IC_REF_ST_M24LR16D_W 0x4D
/* IC Reference for M24LR64D-W: 01011110(b), blockSize: 4, numberBlocks: 0x800
 */
#define I93_IC_REF_ST_M24LR64E_R 0x5E
/* IC Reference for ST25DV04K: 00100100(b), blockSize: 4, numberBlocks: 0x80
 */
#define I93_IC_REF_ST_ST25DV04K 0x24
/* IC Reference for ST25DVHIK: 00100110(b), blockSize: 4, numberBlocks: 0x800
 * or 0x200
 */
#define I93_IC_REF_ST_ST25DVHIK 0x26

/* Product code family for LRI2K */
#define I93_PROD_CODE_ST_LRI2K_MASK I93_IC_REF_ST_LRI2K /* 0x20 */
/* Product code family for LRIS2K */
#define I93_PROD_CODE_ST_LRIS2K_MASK I93_IC_REF_ST_LRIS2K /* 0x28 */
/* Product code family for LRIS64K */
#define I93_PROD_CODE_ST_LRIS64K_MASK I93_IC_REF_ST_LRIS64K /* 0x44 */
/* Product code family for M24LR04E_R */
#define I93_PROD_CODE_ST_M24LR04E_R_MASK 0x58
/* Product code family for M24LR64_R */
#define I93_PROD_CODE_ST_M24LR64_R_MASK I93_IC_REF_ST_M24LR64_R /* 0x2C */
/* Product code family for M24LR16E_R */
#define I93_PROD_CODE_ST_M24LR16E_R_MASK 0x4C
/* Product code family for M24LR64E_R */
#define I93_PROD_CODE_ST_M24LR64E_R_MASK 0x5C
/* Product code family for ST25DV04K/16K/64K */
#define I93_PROD_CODE_ST_ST25DV_K_MASK I93_IC_REF_ST_ST25DV04K

/* ONS, product version (IC manufacturer code) */
/* IC Reference for N36RW02:  00011010(b), blockSize: 4, numberBlocks: 0x40 */
#define I93_IC_REF_ONS_N36RW02  0x1A
/* IC Reference for N24RF04:  00101010(b), blockSize: 4, numberBlocks: 0x80 */
#define I93_IC_REF_ONS_N24RF04  0x2A
/* IC Reference for N24RF04E: 00101110(b), blockSize: 4, numberBlocks: 0x80 */
#define I93_IC_REF_ONS_N24RF04E 0x2E
/* IC Reference for N24RF16:  01001010(b), blockSize: 4, numberBlocks: 0x200 */
#define I93_IC_REF_ONS_N24RF16  0x4A
/* IC Reference for N24RF16E: 01001110(b), blockSize: 4, numberBlocks: 0x200 */
#define I93_IC_REF_ONS_N24RF16E 0x4E
/* IC Reference for N24RF64:  01101010(b), blockSize: 4, numberBlocks: 0x800 */
#define I93_IC_REF_ONS_N24RF64  0x6A
/* IC Reference for N24RF64E: 01101110(b), blockSize: 4, numberBlocks: 0x800 */
#define I93_IC_REF_ONS_N24RF64E 0x6E

#define I93_ST_BLOCKS_PER_SECTOR 32
#define I93_ST_MAX_BLOCKS_PER_READ 32

#define I93_ONS_BLOCKS_PER_SECTOR 32
#define I93_ONS_MAX_BLOCKS_PER_READ 32

/* Sub carrier */
#ifndef RW_I93_FLAG_SUB_CARRIER
#define RW_I93_FLAG_SUB_CARRIER I93_FLAG_SUB_CARRIER_SINGLE
#endif

/* Data rate for 15693 command/response */
#ifndef RW_I93_FLAG_DATA_RATE
#define RW_I93_FLAG_DATA_RATE I93_FLAG_DATA_RATE_HIGH
#endif

/* tag is read-only                        */
#define RW_I93_FLAG_READ_ONLY 0x01
/* tag supports read multi block           */
#define RW_I93_FLAG_READ_MULTI_BLOCK 0x02
/* need to reset DSFID for formatting      */
#define RW_I93_FLAG_RESET_DSFID 0x04
/* need to reset AFI for formatting        */
#define RW_I93_FLAG_RESET_AFI 0x08
/* use 2 bytes for number of blocks        */
#define RW_I93_FLAG_16BIT_NUM_BLOCK 0x10
/* use extended commands */
#define RW_I93_FLAG_EXT_COMMANDS 0x20
/* use Special Frame in Write-Alike commands */
#define RW_I93_FLAG_SPECIAL_FRAME 0x40
/* use SMS bit in Selected state           */
#define RW_I93_FLAG_SELECTED_STATE 0x80

/* searching for type                      */
#define RW_I93_TLV_DETECT_STATE_TYPE 0x01
/* searching for the first byte of length  */
#define RW_I93_TLV_DETECT_STATE_LENGTH_1 0x02
/* searching for the second byte of length */
#define RW_I93_TLV_DETECT_STATE_LENGTH_2 0x03
/* searching for the third byte of length  */
#define RW_I93_TLV_DETECT_STATE_LENGTH_3 0x04
/* reading value field                     */
#define RW_I93_TLV_DETECT_STATE_VALUE 0x05
#define RW_I93_GET_SYS_INFO_MEM_INFO 1
#define RW_T5T_CC_READ_MEM_INFO 0

#define RW_I93_MODE_ADDRESSED 0
#define RW_I93_MODE_NON_ADDRESSED 1

/* capability Container CC Size */
#define RW_I93_CC_SIZE 4
#define RW_I93_CC_SIZE_8 8

#define BITS_PER_BYTE 8
#define NUM_BLOCK_8 8
#define NUM_BLOCK_64 64
#define BLOCK_SIZE_4 4
#define LENGTH_2 2

enum {
    RW_I93_ICODE_SLI,                  /* ICODE SLI, SLIX                  */
    RW_I93_ICODE_SLI_S,                /* ICODE SLI-S, SLIX-S              */
    RW_I93_ICODE_SLI_L,                /* ICODE SLI-L, SLIX-L              */
    RW_I93_TAG_IT_HF_I_PLUS_INLAY,     /* Tag-it HF-I Plus Inlay           */
    RW_I93_TAG_IT_HF_I_PLUS_CHIP,      /* Tag-it HF-I Plus Chip            */
    RW_I93_TAG_IT_HF_I_STD_CHIP_INLAY, /* Tag-it HF-I Standard Chip/Inlyas */
    RW_I93_TAG_IT_HF_I_PRO_CHIP_INLAY, /* Tag-it HF-I Pro Chip/Inlyas      */
    RW_I93_ST_LRI1K,                  /* ST LRI1K                        */
    RW_I93_ST_LRI2K,                  /* ST LRI2K                        */
    RW_I93_ST_LRIS2K,                 /* ST LRIS2K                       */
    RW_I93_ST_LRIS64K,                /* ST LRIS64K                      */
    RW_I93_ST_M24LR64_R,              /* ST M24LR64-R                    */
    RW_I93_ST_M24LR04E_R,             /* ST M24LR04E-R                   */
    RW_I93_ST_M24LR16E_R,             /* ST M24LR16E-R                   */
    RW_I93_ST_M24LR16D_W,             /* ST M24LR16D-W                   */
    RW_I93_ST_M24LR64E_R,             /* ST M24LR64E-R                   */
    RW_I93_ST_ST25DV04K,              /* ST ST25DV04K                    */
    RW_I93_ST_ST25DVHIK,              /* ST ST25DV 16K OR 64K            */
    RW_I93_ONS_N36RW02,                /* ONS N36RW02                      */
    RW_I93_ONS_N24RF04,                /* ONS N24RF04                      */
    RW_I93_ONS_N24RF04E,               /* ONS N24RF04E                     */
    RW_I93_ONS_N24RF16,                /* ONS N24RF16                      */
    RW_I93_ONS_N24RF16E,               /* ONS N24RF16E                     */
    RW_I93_ONS_N24RF64,                /* ONS N24RF64                      */
    RW_I93_ONS_N24RF64E,               /* ONS N24RF64E                     */
    RW_I93_UNKNOWN_PRODUCT             /* Unknwon product version          */
};

/* max reading data if read multi block is supported */
#define RW_I93_READ_MULTI_BLOCK_SIZE 128
/* CC, zero length NDEF, Terminator TLV              */
#define RW_I93_FORMAT_DATA_LEN 8
/* max getting lock status if get multi block sec is supported */
#define RW_I93_GET_MULTI_BLOCK_SEC_SIZE 253

typedef struct {
    uint8_t uid[I93_UID_BYTE_LEN]; /* UID of currently activated       */
    uint8_t block_size;            /* block size of tag, in bytes      */
    uint8_t cc_size;
    uint16_t num_block;            /* number of blocks in tag          */
    uint8_t product_version;       /* tag product version              */
    uint8_t info_flags;            /* information flags                */
    uint8_t ic_reference;          /* IC Reference of tag              */
    uint8_t sent_cmd;              /* last sent command                */
    uint8_t intl_flags;            /* flags for internal information   */
    uint8_t dsfid;                 /* DSFID if I93_INFO_FLAG_DSFID     */
    uint8_t afi;                   /* AFI if I93_INFO_FLAG_AFI         */
    uint8_t i93_t5t_mode;
    uint8_t addr_mode;
    bool connected;
    bool mute_legacy;
#if IS_FEATURE_ON(NCI_FEATURE_RW_NDEF)
    uint8_t t5t_area_start_block;  /* offset of first block of T5T_Area  */
    uint32_t t5t_area_last_offset; /* offset of last byte of T5T_Area  */
    uint8_t t5t_cc_block[I93_BLEN_32BYTES];

    /* Greedy collection with NDEF Detection data */
    uint8_t gre_validity;
    uint8_t gre_cc_content[8];
    uint32_t gre_ndef_tlv_pos;
    uint32_t gre_ndef_tlv_length;
    uint32_t tlv_length;      /* currently detected length        */
    uint8_t tlv_detect_state; /* TLV detecting state              */
    uint8_t tlv_type;         /* currently detected type          */

    uint32_t ndef_tlv_start_offset; /* offset of first byte of NDEF TLV */
    uint32_t ndef_tlv_last_offset;  /* offset of last byte of NDEF TLV  */
    uint32_t max_ndef_length;       /* max NDEF length the tag contains */
    uint32_t ndef_length;           /* length of NDEF data              */

    uint8_t* p_update_data; /* pointer of data to update        */
    uint32_t rw_length;     /* bytes to read/write              */
    uint32_t rw_offset;     /* offset to read/write             */
#endif // IS_FEATURE_ON(NCI_FEATURE_RW_NDEF)
} tT5T_INFO;

extern tT5T_INFO s_t5t_info;

extern int g_dta_mode_enabled;

bool rw_i93_check_legacy_product(uint8_t ic_manuf, uint8_t pdt_code);
tNCI_STATUS rw_i93_get_sys_info(uint8_t* p_uid);
tNCI_STATUS rw_i93_send_cmd_get_sys_info(uint8_t* p_uid, uint8_t extra_flags, tNCI_BUF* p_rsp);
tNCI_STATUS rw_i93_send_cmd_get_ext_sys_info(uint8_t* p_uid, tNCI_BUF* p_rsp);
void rw_i93_send_cmd_set_addressing_mode(bool mode);
tNCI_STATUS rw_i93_send_cmd_stay_quiet(const uint8_t* p_uid);
tNCI_STATUS rw_i93_send_cmd_select(const uint8_t* p_uid);
tNCI_STATUS rw_i93_send_cmd_inventory(uint8_t* p_uid, bool including_afi, uint8_t afi);
tNCI_STATUS rw_i93_send_cmd_read_single_block(uint32_t block_number, bool read_security, tNCI_BUF* p_rsp);
void rw_i93_get_product_version(uint8_t* p_uid);

#if IS_FEATURE_ON(NCI_FEATURE_RW_NDEF)
tNCI_STATUS rw_i93_send_cmd_lock_block(uint32_t block_number);
tNCI_STATUS rw_i93_send_cmd_read_multi_blocks(uint32_t first_block_number, uint32_t number_blocks, tNCI_BUF* p_rsp);
tNCI_STATUS rw_i93_send_cmd_get_multi_block_sec(uint32_t first_block_number,
                                                uint32_t number_blocks, tNCI_BUF* p_rsp);

tNCI_STATUS rw_i93_send_cmd_write_dsfid(uint8_t dsfid);
tNCI_STATUS rw_i93_send_cmd_write_afi(uint8_t afi);
tNCI_STATUS rw_i93_send_cmd_write_single_block(uint32_t block_number,  uint8_t* p_data);

tNCI_STATUS rw_i93_get_next_block_sec(tNCI_BUF* p_rsp);
tNCI_STATUS rw_i93_get_next_blocks(uint32_t offset, tNCI_BUF* p_rsp);

#endif //IS_FEATURE_ON(NCI_FEATURE_RW_NDEF)
#endif //IS_FEATURE_ON(NCI_FEATURE_RW_T5T)
#endif //RW_T5T_COMMON_H